package itu.dk.bosk.ex6_2.ex2;

import java.util.ArrayList;

public class Person {
	protected String name = "Hans";
	private ArrayList<Role> roles = new ArrayList<Role>();
	
	public void addRole(Role role) {
		roles.add(role);
	}
	
	public static void main(String[] args) {
		
		Person inst = new Person();
		Person cons = new Person();
		Person instAndCons = new Person();
		
		inst.addRole(new InstructorRole());
		cons.addRole(new ConsultantRole());		
		instAndCons.addRole(new InstructorRole());
		instAndCons.addRole(new ConsultantRole());
		
		System.out.println(cons);
		System.out.println(inst);
		System.out.println(instAndCons);
	}
	
	@Override
	public String toString() {
		
		String out = name + " has roles: ";
		for(Role r : roles) {
			out += r.getClass().getName() + ", ";
		}
		
		return out;
	}
}
